ms = {};
ms.action = '';
ms.uniform = true;
ms.ready = function(type,action){
	if(type == 2){
		ms.doubleRelate();
	}else{
		
	}
	ms.action = action;
};

ms.doubleRelate = function(){
	ms.fc = jQuery('#f_cate');
	ms.sc = jQuery('#s_cate');
	ms.fc.change(function(){
		ms.empty(ms.sc);
		ms.ajax(ms.doubleCallback,$(this).val());
	});
};

ms.empty = function(tar){
	tar.html('<option value = ""></option>');
	if(ms.uniform)
	$.uniform.update(ms.sc);
}

ms.doubleCallback = function(data){
	if(data.state){
		if(ms.uniform){
			ms.sc.append(data.html);
		 	$.uniform.update(ms.sc);
		}else{
			ms.sc.html(data.html);	
		}
	}
};

ms.ajax = function(callback,id){
	$.ajax({
	  type: "get",
	  url: ms.action+'/'+id,
	  dataType:'json',
	}).done(function( msg ) {
		callback(msg);
	});
}
